n = -10:1:10;
x = (2*n + 5).*(n > -4 & n < 0) + 6.*(n >= 0 & n <= 4);
subplot(331)
stem(n, x, 'filled')
title('序列波形')
xlabel('n')
ylabel('x(n)')
axis([-10 10 -1 8])


% 延迟单位阶跃序列 u(n)
N = length(n);
u = ones(1, N);
% 延迟的单位阶跃序列表示 X(n)
x_delayed = x .* u;
subplot(332)
stem(n, x_delayed, 'filled')
title('单位阶跃序列表示 X(n)序列波形')
axis([-10 10 -1 8])


x1=2*x;
n1=n-2;
subplot(334);
stem(n1,x1, 'filled');
title('x1(n) = 2x(n-2)');
xlabel('n');
ylabel('x1(n)');
axis([-10 10 -1 8]);

x2=2*x;
n2=n+2;
subplot(335);
stem(n2,x2, 'filled');
title('x2(n) = 2x(n+2)');
xlabel('n');
ylabel('x2(n)');
axis([-10 10 -1 8]);


x3=x;
n3=2-n;
subplot(336);
stem(n3,x3, 'filled');
title('x3(n) = x(2-n)');
xlabel('n');
ylabel('x3(n)');
axis([-10 10 -1 8]);

